/**
 * Created by Francis.LW on 2017/10/20.
 *
 * 信息模板服务接口
 */
import {postRequest, getRequest} from '@/common/request'
import {urls} from './url'

const messageTemplateApi = urls.messageTemplate

function listAll(success, complete) {
  postRequest(messageTemplateApi.listAll, {}, {}, success, complete)
}

function list(param, page, pageSize, success, complete) {
  postRequest(messageTemplateApi.list + '?currentpage=' + page + '&pagesize=' + pageSize, {}, param, success, complete)
}

function save(param, success, complete) {
  postRequest(messageTemplateApi.save, {}, param, success, complete)
}

function update(id, param, success, complete) {
  postRequest(messageTemplateApi.update + id, {}, param, success, complete)
}


function getById(id, success, complete) {
  getRequest(messageTemplateApi.getById + id, {}, success, complete)
}

function remove(ids, success, complete) {
  postRequest(messageTemplateApi.remove, {}, ids, success, complete)
}

function deleteSingle(id, success, complete) {
  let ids = []
  ids.push(id)
  remove(ids, success, complete)
}

export default {
  listAll,
  list,
  save,
  update,
  getById,
  remove,
  deleteSingle
}
